package edu.calvin.djs32.cs214.interpreters.drivers;

import java.io.IOException;

import org.antlr.runtime.ANTLRFileStream;
import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.tree.CommonTreeNodeStream;
import org.antlr.runtime.tree.Tree;

import edu.calvin.djs32.cs214.interpreters.calculator.Calculator;
import edu.calvin.djs32.cs214.interpreters.frontend.Hobbes2008FrontEnd;
import edu.calvin.djs32.cs214.interpreters.frontend.Hobbes2008TIRBuilder;

public class CalculatorCLIDriver {
	public static void main(String[] args) throws RecognitionException, IOException {
		Tree process = new Hobbes2008FrontEnd().process(new ANTLRFileStream("calc.hob"));
		Calculator myCalculator = new Calculator();	
		System.out.println("Reading from \"calc.hob\"...");
		System.out.println("The result is: " + new Hobbes2008TIRBuilder(new CommonTreeNodeStream(process))
        .expression().accept(myCalculator));
	}

}
